package com.frxuexi.sign

import com.frxuexi.lib_base.BaseViewModel
import com.frxuexi.lib_base.entity.ApiResponse
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

@HiltViewModel
class SignViewModel @Inject constructor(private val signRepository: SignRepository):BaseViewModel<SignIntent>() {
    override fun handleIntent(intent: SignIntent) {
        when(intent){
            is SignIntent.getSigns->{
                httpRequest(signRepository.getSigns(intent.map) as Flow<ApiResponse<Any>>)
            }
            is SignIntent.sign->{
                httpRequest(signRepository.sign(intent.map) as Flow<ApiResponse<Any>>)
            }
        }
    }
}